Header Goes here
<?php
//these need to go in a header file somedoay
//and they need to be well marked for later modification
include('settings.php');


$userid=0;
$username="Guest";
$auth_token="";


if( $_SERVER['REQUEST_METHOD']=="POST")
{
	$con = mysql_connect(localhost,$sqluser,$sqlpass);
	@mysql_select_db($sqldbase) or die( "Unable to select database");
	$given_username=mysql_real_escape_string($_POST['username']);
	$passhash = md5($_POST['password']);
	$query = "select * from users where handle='$given_username' and passhash='$passhash';";
	$response = mysql_query($query,$con);
	mysql_close($con);
	if(mysql_numrows($response)==1){
		$_SESSION['userid']=mysql_result($response,0,"userid");
		$_SESSION['username']=mysql_result($response,0,"handle");
		$_SESSION['auth_token']=md5($passhash.date("m/d/y"));
	
	}
	else
	{
	echo("Login Failed");
	
	}


}



if(!isset( $_SESSION['userid'] ))
	{
	$_SESSION['userid']=0;
	$_SESSION['username']="Guest";
	$_SESSION['auth_token']="";
	$_SESSION['forum']=0;
	$_SESSION['thread']=0;
	}
else
	{
	$userid=$_SESSION['userid'];
	$username=$_SESSION['username'];
	$auth_token=$_SESSION['auth_token'];
	$forum=$_SESSION['forum'];
	$thread=$_SESSION['thread'];
	} 






echo("<h1>Hello $username</h1>");

?>
<form method="post" name="login">
<table>
<tr>
<td>Username:</td><td><input type="text" name="username"></input></td>
</tr>
<tr>
<td>Password:</td><td><input type="password" name="password"></input></td>
</tr>
<tr><td>
<input type="submit" value="Login"></input></td>
</tr>
</table>
</form>






Footer goes here